#ifndef __APP_DEVICE_H__
#define __APP_DEVICE_H__

#include"app_buffer.h"
#include<pthread.h>
#include "app_message.h"

typedef struct DeviceObj
{
    ConnectionType type;    //设备的连接类型
    Buffer *input_buffer;   //设备的输入缓存
    Buffer *output_buffer;  //设备的输出缓存
    char *name;             //设备的文件名称
    int fd;                 //设备的文件描述符
    pthread_t read_thread;  //设备后台的读线程
}Device;

Device *app_device_init(char *dev_name);

int app_device_start(Device *dev);

int app_device_stop(Device *dev);

void app_device_deinit(Device *dev);

int app_device_write(Device *dev, void *data, size_t len);



#endif /* __APP_DEVICE_H__ */